package de.hska.pwmanager.transfer.model;

import java.util.ArrayList;
import java.util.List;

import de.hska.pwmanager.persistence.model.PasswordCategory;
import de.hska.pwmanager.persistence.model.PasswordData;

public class PasswordDataTransfer {
	private Long id;
	private String notes;
	private List<PasswordUserHashTransfer> passwordUserHashs = new ArrayList<PasswordUserHashTransfer>();
	private String title;
	private String username;
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	private Long passwordCategoryID;
	
	public Long getPasswordCategoryID() {
		return passwordCategoryID;
	}

	public void setPasswordCategoryID(Long passwordCategoryID) {
		this.passwordCategoryID = passwordCategoryID;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

	public List<PasswordUserHashTransfer> getPasswordUserHashs() {
		return passwordUserHashs;
	}

	public void setPasswordUserHashs(
			List<PasswordUserHashTransfer> passwordUserHashs) {
		this.passwordUserHashs = passwordUserHashs;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

//	@SuppressWarnings("unchecked")
//	public List<PasswordUserHashTransfer> getPasswordUserHashTransfers() {
//		Object o = this.getPasswordUserHashs();
//		return (List<PasswordUserHashTransfer>) o;
//	}
	
	public PasswordData morph() {
		PasswordData morphed = new PasswordData();
		morphed.setId(this.getId());
		morphed.setNotes(getNotes());
		morphed.setTitle(getTitle());
		morphed.setPasswordCategory(new PasswordCategory().setId(this.getPasswordCategoryID()));
		morphed.setUsername(this.getUsername());
		return morphed;
	}
}
